package com.xxy.book.dao;

import com.xxy.book.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @Author Xu XianYun
 * @Date 2022-12-16
 * @Description
 */
@Mapper
public interface UserMapper {

    /* 根据 id 查询 用户 */
    User selectUserById(@Param("id") Integer id);

    /* 根据 email 查询用户 */
    User selectUserByEmail(@Param("email") String email);

    /* 根据 username 查询用户 */
    User selectUserByName(@Param("username") String username);

    /* 插入用户 (注册) */
    int insertUser(User user);

    /* 更新密码 */
    int updatePassword(@Param("id") Integer id, @Param("password") String password);

    /* 更新用户状态 */
    int updateStatus(@Param("id") Integer id, @Param("status") int status);

}
